

			  {include file="app/plug/view/giftmanage/nav"}
               <style>
  .closebtn{width:30px; height:30px; position:absolute; background:#F00; border-radius:30px; cursor:pointer; margin-top:-20px; margin-left:80px; text-align:center}
  .closebtn i{color:#FFF; font-size:14px; margin-top:7px;}
  </style>

  <link rel="stylesheet" type="text/css" href="{__PUBLIC__}gift/select/css/multi-select.css">
  
  
<link rel="stylesheet" href="{__PUBLIC__}assets/css/chosen.min.css" />
<style>
a:link,a:visited{color:#00C}
</style>

				<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
					<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
				</div>
			</div>

			<div class="main-content">
				<div class="main-content-inner">
					<div class="breadcrumbs ace-save-state" id="breadcrumbs">
						<ul class="breadcrumb">
							<li>
								<i class="ace-icon fa fa-home home-icon"></i>
								<a href="index.php?r=manage/index/index">首页</a>
							</li>
							<li class="active">{$pagetext['0']}</li>
						</ul><!-- /.breadcrumb -->

						<div class="nav-search" id="nav-search">
							<form class="form-search">
								<span class="input-icon">
									<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
									<i class="ace-icon fa fa-search nav-search-icon"></i>
								</span>
							</form>
						</div><!-- /.nav-search -->
					</div>

					<div class="page-content">
                    <div class="page-header">
							<h1>
								{$pagetext['0']}
								<small>
									<i class="ace-icon fa fa-angle-double-right"></i>
									{$pagetext['1']}
								</small>
							</h1>
						</div>
                        <div class="widget-box">
												<div class="widget-header">
													<h4 class="widget-title">{$pagetext['1']}</h4>
												</div>

												<div class="widget-body">
													<div class="widget-main">
												
											</div>
                 
									<div class="widget-body">
													<div class="widget-main">
                                                    

														<div>
															<label  class="formtitle" for="form-field-8">问答标题</label>

														<input type="text" name="title" id="title" value="{$ret['title']}" placeholder="问答标题" class="form-control">
														</div>
                                                        
                                                      
														
														<hr>
                                                        <div>
															<label  class="formtitle" for="form-field-8">提问用户</label>

														<input type="text" name="user" id="user" value="{$ret['user']}" placeholder="随意填写网名" class="form-control">
														</div>
                                                        
                                                      
														
														<hr>
                                                        
                                                        	<div>
															<label  class="formtitle"  for="form-field-11">封面</label>

<div class="closebtn" tupian="tupian"><i class="ace-icon glyphicon glyphicon-trash"></i></div>
											<div class="uploadimg tupian" onClick="upthis()">
                                              {if !$ret['pic']}
                                              <i class="ace-icon fa fa-cloud-upload"></i>
                                              <dt>450*450</dt>
                                              {else}
                                              <img src="{$ret['pic']}" />
                                              {/if}
                                              
                                            </div>
										</div>
                                        <input type="text" class="form-control" name="pic" id="tupian"   value="{$ret['pic']}" style="display:none" >
                                                 <input type="file"  name="file"  id="up_tupian"  onChange="Uploadthis('tupian','up_tupian')" style="display:none"  >
                                                 
                                              

													<hr />
                                                	<div>
															<label  class="formtitle" for="form-field-8">分类</label>

														
														<select class="chosen-select form-control" id="pid" data-placeholder="Choose a State..." name="gonglue_send">
																<option value="0">请选择分类</option>
                                                                {foreach $plug_gift_wendatype as $vs}
                                                           {if $vs['pid']=='0'}
                                                                 <option value="{$vs['id']}" style="font-size:14px; font-weight:bold; color:#F00" disabled="disabled">{$vs['name']}</option>
                                                                 {else}
                                                                  <option value="{$vs['id']}"   {if $vs['id']==$ret['pid']}  selected="selected" {/if} >{$vs['name']}</option>
                                                                  {/if}
                                                               
                                                                {/foreach}
														
															</select>

														</div>
														
													<hr />
                                                
                                                
                                                 	<div>
															<label  class="formtitle" for="form-field-8">问题说明</label>

												<textarea class="form-control" id="q"   name="q" style="height:150px;">{$ret['q']}</textarea>
														</div>
                                                        <hr />
                                                
                                                
                                                 	<div>
															<label  class="formtitle" for="form-field-8">其他回答 <span style="font-size:14px; font-weight:normal; color:#00C; margin-left:5px"><a href="javascript:;" onclick="insertime()">插入时间</a></span></label>

												<textarea class="form-control" id="qt"   name="qt" style="height:150px;">{$ret['qt']}</textarea>
														</div>
                                                        <p style="font-size:14px; color:#00F; margin-top:5px;">一行一个 格式：  回答的问题+时间【Y-m-d H:i:s】
                                                        
                                                        	<hr>
                                                
                                                
                                                 	<div>
															<label  class="formtitle" for="form-field-8">回答内容</label>

												<div class="layui-form-item">
  <textarea id="adddom" name="body" style="display: none;">{$ret['mybody']}</textarea>
  </div>
														</div>
                                                
                                              
                                                
                                                
                                                 </div>
													

								{$html}
                                
                                <div class="clearfix form-actions"  style="margin-bottom:-0px;" >
										<div class="col-md-offset-1 col-md-9">
											<input type="submit"  class="btn btn-info " id="save"  onclick="SendPost()" value="保存" />

											&nbsp; &nbsp; &nbsp;
											<a href="index.php?r=plug/giftmanage/strategy"><button class="btn"  type="button">
												
												返回列表
											</button></a>
										</div>
									</div>
                                    
                                                   </div>
								
                               
			

			<!-- basic scripts -->

		<!--[if !IE]> -->
		<script src="{__PUBLIC__}assets/js/jquery-2.1.4.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="{__PUBLIC__}assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
        <script src="{__PUBLIC__}assets/js/ace-extra.min.js"></script>
	<!-- ace scripts -->
	<!--[if !IE]> -->
		<script src="{__PUBLIC__}assets/js/jquery-2.1.4.min.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="{__PUBLIC__}assets/js/bootstrap.min.js"></script>

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="{__PUBLIC__}assets/js/excanvas.min.js"></script>
		<![endif]-->
		<script src="{__PUBLIC__}assets/js/jquery-ui.custom.min.js"></script>
		<script src="{__PUBLIC__}assets/js/jquery.ui.touch-punch.min.js"></script>
		<script src="{__PUBLIC__}assets/js/bootbox.js"></script>
		<script src="{__PUBLIC__}assets/js/jquery.easypiechart.min.js"></script>
		<script src="{__PUBLIC__}assets/js/jquery.gritter.min.js"></script>
		<script src="{__PUBLIC__}assets/js/spin.js"></script>

		<!-- ace scripts -->
		<script src="{__PUBLIC__}assets/js/ace-elements.min.js"></script>
		<script src="{__PUBLIC__}assets/js/ace.min.js"></script>
        
        




		<!-- inline scripts related to this page -->
        <link rel="stylesheet" href="{__PUBLIC__}global/message/css/jquery.my-message.1.1.css" />
		<script type="text/javascript" src="{__PUBLIC__}global/message/js/jquery.my-message.1.1.js"></script>
        <script src="{__PUBLIC__}global/layer/layer.js"></script>
        <script src="{__PUBLIC__}assets/js/chosen.jquery.min.js"></script>
        <script src="{__PUBLIC__}global/js/Validform_v5.3.2_min.js"></script>
        <script src="{__PUBLIC__}global/js/ajaxfileupload.js"></script>
        <link href="{__PUBLIC__}index/weget/layui/css/layui.css" rel="stylesheet" type="text/css" />
        <style>
		hr{ margin-top:20px; margin-bottom:20px;}
		.layui-form-label{ padding:0px; margin-top:10px;}
		</style>
          <script type="text/javascript" src="{__PUBLIC__}index/weget/layui/layui.js"></script>
        <script src="{__PUBLIC__}global/js/index.js"></script>
        
 
      

		<script>

function insertime(){
	 var myDate = new Date;
    var year = myDate.getFullYear();//获取当前年
    var yue = myDate.getMonth()+1;//获取当前月
    var date = myDate.getDate();//获取当前日
    var h = myDate.getHours();//获取当前小时数(0-23)
    var m = myDate.getMinutes();//获取当前分钟数(0-59)
    var s = myDate.getSeconds();//获取当前秒
	
	
	   var s_val = $('#qt').val();
        // 当前按钮的值
        var btn_val = year+'-'+yue+'-'+date+' '+h+':'+m+':'+s;
        // 合并字符串
        var v_val = s_val + btn_val;
        // 赋值给文本框
        $('#qt').val(v_val);

	}

		//ZhiForm("#form","index.php?r=plug/gift/giftlist","保存中","保存","null");
		//ajax上传
	Uploadthis=function(obj,thisid){
	  layer.load(2);
		$.ajaxFileUpload({  
				url:'index.php?r=manage/File/question',  
				secureuri:false,  
				fileElementId:thisid,//file标签的id  
				dataType: 'json',//返回数据的类型    
				success: function (data, status) {  
				   $("#"+obj).val(data.url);
				   $('.'+obj).html('<img src="'+data.url+'">');
				   layer.closeAll('loading');
				}
			});  	
		
		}
	function upthis(){
	document.getElementById("up_tupian").click(); 	
     }
	 function upthis2(){
	document.getElementById("up_tupian2").click(); 	
     }
	 
	  function upthis3(){
	document.getElementById("up_tupian3").click(); 	
     }
	 
	  function upthis4(){
	document.getElementById("up_tupian4").click(); 	
     }
if(!ace.vars['touch']) {
					$('.chosen-select').chosen({allow_single_deselect:true}); 
					//resize the chosen on window resize
			
					$(window)
					.off('resize.chosen')
					.on('resize.chosen', function() {
						$('.chosen-select').each(function() {
							 var $this = $(this);
							 $this.next().css({'width': $this.parent().width()});
						})
					}).trigger('resize.chosen');
					//resize chosen on sidebar collapse/expand
			
			
			
				
				}

</script>
 <script>
layui.use(['form', 'layedit', 'laydate'], function(){
   form = layui.form
  ,layer = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
  
   
  
   //创建一个编辑器
   editIndex = layedit.build('adddom', {
  tool: ['strong','del','left', 'center', 'right', '|', 'face','|','link']
});   

 
  
});


function SendPost(){

 var title=$("#title").val();
 var tupian=$("#tupian").val();
  var pid=$("#pid").val();
  var user=$("#user").val();
  var q=$("#q").val();
  var qt=$("#qt").val();
  {if ACTION_NAME=='editorsquestion'}
  var id=$("#id").val();
  {/if}
 var mybody=layedit.getContent(editIndex);

 $.ajax({
		 url:'{$url}',
         type: 'post',
		 data:{title:title,pic:tupian,pid:pid,user:user,q:q,qt:qt,mybody:mybody{if ACTION_NAME=='editorsquestion'},id:id{/if}},  
         dataType: 'json',
         success: function(data){
			 console.log(data);
			if (data.status == 'y') {
				window.location.href = 'index.php?r=plug/giftmanage/question';
				return false;
				}else if (data.status == 'n') {
				 error(data.info);
			   return false;
			}
			
		


			
		
			 
		 }
   });	
 return false;

}



 $(".closebtn").click(function(){
		 
		  var obj=$(this).attr("tupian");
		  
		  $("."+obj).html('<i class="ace-icon fa fa-cloud-upload"></i><dt>450*450</dt>');
		  $("#"+obj).val('');
	 });
		</script>
		
	</body>
</html>
